/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.6.64_3306
 Source Server Type    : MySQL
 Source Server Version : 50736
 Source Host           : 192.168.6.64:3306
 Source Schema         : big_screen_designer

 Target Server Type    : MySQL
 Target Server Version : 50736
 File Encoding         : 65001

 Date: 15/03/2022 17:18:48
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_project
-- ----------------------------
DROP TABLE IF EXISTS `t_project`;
CREATE TABLE `t_project`  (
                              `create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
                              `update_time` timestamp(0) NULL DEFAULT NULL,
                              `create_user` varchar(64)  NULL DEFAULT NULL,
                              `update_user` varchar(64)  NULL DEFAULT NULL,
                              `id` varchar(64)  NOT NULL,
                              `is_deleted` bit(1) NOT NULL DEFAULT b'0',
                              `name` varchar(64)  NOT NULL COMMENT '项目名',
                              `description` varchar(255) NULL DEFAULT NULL COMMENT '项目描述',
                              `is_public` bit(1) NULL DEFAULT b'0' COMMENT '是否公开',
                              `owner_id` varchar(64)  NOT NULL COMMENT '所有者ID',
                              PRIMARY KEY (`id`) USING BTREE,
                              INDEX `owner_id_index`(`owner_id`) USING BTREE COMMENT '所有者ID'
) ENGINE = InnoDB  DEFAULT CHARSET=utf8  COMMENT = '项目' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_project_share
-- ----------------------------
DROP TABLE IF EXISTS `t_project_share`;
CREATE TABLE `t_project_share`  (
                                    `create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
                                    `update_time` timestamp(0) NULL DEFAULT NULL,
                                    `create_user` varchar(64)  NULL DEFAULT NULL,
                                    `update_user` varchar(64)  NULL DEFAULT NULL,
                                    `id` varchar(64) NOT NULL,
                                    `is_deleted` bit(1) NOT NULL DEFAULT b'0',
                                    `project_id` varchar(64)  NOT NULL COMMENT '来源项目ID',
                                    `share_id` varchar(64)  NOT NULL COMMENT '被分享者ID',
                                    `share_role` int(11) NOT NULL DEFAULT 0 COMMENT '被分享者分配的角色： 0 预览者、1 开发者',
                                    PRIMARY KEY (`id`) USING BTREE,
                                    INDEX `source_id_index`(`project_id`) USING BTREE COMMENT '项目ID 索引'
) ENGINE = InnoDB  DEFAULT CHARSET=utf8  COMMENT = '项目分享表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_user
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user`  (
                           `create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
                           `update_time` timestamp(0) NULL DEFAULT NULL,
                           `create_user` varchar(64)  NULL DEFAULT NULL,
                           `update_user` varchar(64)  NULL DEFAULT NULL,
                           `id` varchar(64) NOT NULL,
                           `is_deleted` bit(1) NOT NULL DEFAULT b'0',
                           `name` varchar(64) NOT NULL COMMENT '姓名',
                           `account` varchar(64) NOT NULL COMMENT '账号',
                           `email` varchar(64) NOT NULL COMMENT '邮箱',
                           `role` int(11) NOT NULL DEFAULT 0 COMMENT '角色： 0普通用户、1管理员',
                           `out_id` varchar(64)  NULL DEFAULT NULL COMMENT '外部系统用户Id',
                           `password` varchar(128) NULL DEFAULT NULL COMMENT '密码：加密密码',
                           PRIMARY KEY (`id`) USING BTREE,
                           UNIQUE INDEX `account_index`(`account`) USING BTREE COMMENT '账号唯一索引',
                           UNIQUE INDEX `email_index`(`email`) USING BTREE COMMENT '邮箱唯一索引'
) ENGINE = InnoDB  DEFAULT CHARSET=utf8 COMMENT = '用户表' ROW_FORMAT = Dynamic;

BEGIN;
INSERT INTO `t_user`(`create_time`, `update_time`, `create_user`, `update_user`, `id`, `is_deleted`, `name`, `account`, `email`, `role`, `out_id`, `password`) VALUES ('2022-03-16 14:32:48', '2022-03-16 17:46:53', 'admin', 'admin', '-1069948928', b'0', 'BIM-VIEW', 'admin', '2358009937@qq.com', 1, NULL, 'xPwdksUoYFYDinB5/18AnA==');
COMMIT;
-- ----------------------------
-- Table structure for t_user_share
-- ----------------------------
DROP TABLE IF EXISTS `t_user_share`;
CREATE TABLE `t_user_share`  (
                                 `create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP,
                                 `update_time` timestamp(0) NULL DEFAULT NULL,
                                 `create_user` varchar(64)  NULL DEFAULT NULL,
                                 `update_user` varchar(64)  NULL DEFAULT NULL,
                                 `id` varchar(64)  NOT NULL,
                                 `is_deleted` bit(1) NOT NULL DEFAULT b'0',
                                 `source_id` varchar(64) NOT NULL COMMENT '来源用户ID',
                                 `share_id` varchar(64)  NOT NULL COMMENT '被分享者ID',
                                 `share_role` int(11) NOT NULL COMMENT '被分享者分配角色，0 查看者、1 开发者',
                                 `visual_id` varchar(64) NOT NULL COMMENT '分享的大屏ID',
                                 PRIMARY KEY (`id`) USING BTREE,
                                 INDEX `source_id_index`(`source_id`) USING BTREE COMMENT '来源ID 索引'
) ENGINE = InnoDB  DEFAULT CHARSET=utf8  COMMENT = '用户分享表' ROW_FORMAT = Dynamic;


ALTER TABLE `t_visual`
    ADD COLUMN `owner_id` varchar(64)  NULL DEFAULT NULL COMMENT '所有者ID',
    ADD COLUMN `project_id` varchar(64)  NULL DEFAULT NULL COMMENT '所属项目ID',
    MODIFY COLUMN `create_user` varchar(64) NULL DEFAULT NULL AFTER `update_time`,
    MODIFY COLUMN `update_user` varchar(64) NULL DEFAULT NULL AFTER `create_user`;

ALTER TABLE `t_visual_category`
    ADD COLUMN `owner_id` varchar(64)  NULL DEFAULT NULL COMMENT '所有者ID',
    ADD COLUMN `project_id` varchar(64)  NULL DEFAULT NULL COMMENT '所属项目ID',
    MODIFY COLUMN `create_user` varchar(64) NULL DEFAULT NULL AFTER `update_time`,
    MODIFY COLUMN `update_user` varchar(64) NULL DEFAULT NULL AFTER `create_user`;

ALTER TABLE `t_visual_db`
    ADD COLUMN `owner_id` varchar(64)  NULL DEFAULT NULL COMMENT '所有者ID',
    ADD COLUMN `project_id` varchar(64)  NULL DEFAULT NULL COMMENT '所属项目ID',
    MODIFY COLUMN `create_user` varchar(64) NULL DEFAULT NULL AFTER `update_time`,
    MODIFY COLUMN `update_user` varchar(64) NULL DEFAULT NULL AFTER `create_user`;

ALTER TABLE `t_blade_file`
    MODIFY COLUMN `create_user` varchar(64) NULL DEFAULT NULL AFTER `update_time`,
    MODIFY COLUMN `update_user` varchar(64) NULL DEFAULT NULL AFTER `create_user`;

ALTER TABLE `t_visual_config`
    MODIFY COLUMN `create_user` varchar(64) NULL DEFAULT NULL AFTER `update_time`,
    MODIFY COLUMN `update_user` varchar(64) NULL DEFAULT NULL AFTER `create_user`;

ALTER TABLE `t_visual_map`
    MODIFY COLUMN `create_user` varchar(64) NULL DEFAULT NULL AFTER `update_time`,
    MODIFY COLUMN `update_user` varchar(64) NULL DEFAULT NULL AFTER `create_user`,
    MODIFY COLUMN `name` varchar(100) NULL COMMENT '地图名称' AFTER `is_deleted`,
    ADD COLUMN `code` varchar(64) NULL COMMENT '区域编码' AFTER `name`;



SET FOREIGN_KEY_CHECKS = 1;
